<?php
/**
 * @version 0.8.3 2010-10-07
 * @package Joomla
 * @subpackage LeagueResults
 * @copyright (C)  2008, 2009, 2010 Henryk Drozd
 * @license GNU/GPL, see LICENSE.php
 * LeagueResults is free software; you can redistribute it and/or
 * modify it under the terms of the GNU General Public License 2
 * as published by the Free Software Foundation.

 * LeagueResults is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 * GNU General Public License for more details.
 */

// Check to ensure this file is included in Joomla!
defined('_JEXEC') or die('Restricted access');

jimport('joomla.application.component.model');

class lrModelClub extends JModel
{
	var $_club = null;
	var $_id = null;
	
	function __construct()
	{
	parent::__construct();
	$id = JRequest::getVar ('id', 0);
	$this->_id = $id;
	}
	
	
	function getList()
	{
	if (!$this->_club)
		{
		
		$query = "SELECT c.name, c.shortname, c.city, c.published, t.id,
				t.club_id, t.name AS teamname, t.tablename AS teamshortname, t.tbadge,
				t.description AS teamdescription
				FROM #__lr_clubs AS c
				JOIN #__lr_teams AS t ON (t.club_id = c.id)
				WHERE c.id = '".$this->_id."'";
		$this->_club = $this->_getList($query, 0, 0);
/*		
		if (!($this->_db->setQuery($query))){
			echo 'Error in query<br>';
			}
		//print_r ($this->_db);
		echo '<br><br><br>';


//		$this->_club = $this->_db->loadObject();
		
		
		//print_r ($this->_club);
		if (!$this->_club->published)
			{
			JError::raiseError(404, "Invalid ID provided");
			}*/
		}
	return $this->_club;
	}
}

?>